package com.shasselclub.project.ask.question.service.impl;

import java.util.List;
import com.shasselclub.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shasselclub.project.ask.question.mapper.QuestionMapper;
import com.shasselclub.project.ask.question.domain.Question;
import com.shasselclub.project.ask.question.service.IQuestionService;
import com.shasselclub.common.utils.text.Convert;

/**
 * 问卷管理Service业务层处理
 * 
 * @author zhengyunfei
 * @date 2022-08-02
 */
@Service
public class QuestionServiceImpl implements IQuestionService 
{
    @Autowired
    private QuestionMapper questionMapper;

    /**
     * 查询问卷管理
     * 
     * @param id 问卷管理主键
     * @return 问卷管理
     */
    @Override
    public Question selectQuestionById(Long id)
    {
        return questionMapper.selectQuestionById(id);
    }
    @Override
    public Question selectQuestion()
    {
        return questionMapper.selectQuestion();
    }

    /**
     * 查询问卷管理列表
     * 
     * @param question 问卷管理
     * @return 问卷管理
     */
    @Override
    public List<Question> selectQuestionList(Question question)
    {
        return questionMapper.selectQuestionList(question);
    }

    /**
     * 新增问卷管理
     * 
     * @param question 问卷管理
     * @return 结果
     */
    @Override
    public int insertQuestion(Question question)
    {
        question.setCreateTime(DateUtils.getNowDate());
        return questionMapper.insertQuestion(question);
    }

    /**
     * 修改问卷管理
     * 
     * @param question 问卷管理
     * @return 结果
     */
    @Override
    public int updateQuestion(Question question)
    {
        question.setUpdateTime(DateUtils.getNowDate());
        return questionMapper.updateQuestion(question);
    }

    /**
     * 批量删除问卷管理
     * 
     * @param ids 需要删除的问卷管理主键
     * @return 结果
     */
    @Override
    public int deleteQuestionByIds(String ids)
    {
        return questionMapper.deleteQuestionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除问卷管理信息
     * 
     * @param id 问卷管理主键
     * @return 结果
     */
    @Override
    public int deleteQuestionById(Long id)
    {
        return questionMapper.deleteQuestionById(id);
    }
}
